/*
 *    Copyright (c) 2018-2025, lengleng All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: lengleng (wangiegie@gmail.com)
 */

package com.pig4cloud.pigx.strategy.entity;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.pig4cloud.pigx.common.customize.utils.serializer.BigDecimalToPlainStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 策略订单-合约
 *
 * @since 2022-11-24 10:39:26
 */
@Data
@TableName("strategy_order_contract")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "策略订单-合约")
public class StrategyOrderContract extends Model<StrategyOrderContract> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty(value = "主键")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    /**
     * 重试下单的源订单id
     */
    @ApiModelProperty(value = "重试下单的源订单id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long srcId;

    /**
     * 第n次重试下单
     */
    @ApiModelProperty(value = "第n次重试下单")
    private Integer retryCount;

    /**
     * 任务id
     */
    @ApiModelProperty(value = "任务id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long taskId;

    /**
     * 用户id
     */
    @ApiModelProperty(value = "用户id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long userId;

    /**
     * 平台id
     */
    @ApiModelProperty(value = "平台id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long platformId;

    /**
     * 仓位id
     */
    @ApiModelProperty(value = "仓位id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long positionId;

    /**
     * 产品名称
     */
    @ApiModelProperty(value = "产品名称")
    private String productName;

    /**
     * 价格
     */
    @ApiModelProperty(value = "价格")
    @JsonSerialize(using = BigDecimalToPlainStringSerializer.class)
    private BigDecimal price;

    /**
     * 类型（0市价单、1限价单）
     */
    @ApiModelProperty(value = "类型（0市价单、1限价单）")
    private String type;

    /**
     * 业务类型（0开仓、1补仓、2平仓、3锁仓、4正向止盈平仓、5正向止盈回滚、6手动开仓、7手动平仓、8止盈、9止损、10部分平仓）
     */
    @ApiModelProperty(value = "业务类型（0开仓、1补仓、2平仓、3锁仓、4正向止盈平仓、5正向止盈回滚、6手动开仓、7手动平仓、8止盈、9止损、10部分平仓）")
    private String businessType;

    /**
     * 仓位模式（0逐仓、1全仓）
     */
    @ApiModelProperty(value = "仓位模式（0逐仓、1全仓）")
    private String positionMode;

    /**
     * 方向（0做多、1做空）
     */
    @ApiModelProperty(value = "方向（0做多、1做空）")
    private String side;

    /**
     * 操作类型（0开仓、1平仓）
     */
    @ApiModelProperty(value = "操作类型（0开仓、1平仓）")
    private String operationType;

    /**
     * 订单面值
     */
    @ApiModelProperty(value = "订单面值")
    @JsonSerialize(using = BigDecimalToPlainStringSerializer.class)
    private BigDecimal orderValue;

    /**
     * 张面值
     */
    @ApiModelProperty(value = "张面值")
    @JsonSerialize(using = BigDecimalToPlainStringSerializer.class)
    private BigDecimal sheetValue;

    /**
     * 数量（张）
     */
    @ApiModelProperty(value = "数量（张）")
    private Integer num;

    /**
     * 倍数
     */
    @ApiModelProperty(value = "倍数")
    @JsonSerialize(using = BigDecimalToPlainStringSerializer.class)
    private BigDecimal multiple;

    /**
     * 已成交数量（张）
     */
    @ApiModelProperty(value = "已成交数量（张）")
    private Integer dealNum;

    /**
     * 未成交数量（张）
     */
    @ApiModelProperty(value = "未成交数量（张）")
    private Integer noDealNum;

    /**
     * 成交均价
     */
    @ApiModelProperty(value = "成交均价")
    @JsonSerialize(using = BigDecimalToPlainStringSerializer.class)
    private BigDecimal dealAvg;

    /**
     * 手续费
     */
    @ApiModelProperty(value = "手续费")
    @JsonSerialize(using = BigDecimalToPlainStringSerializer.class)
    private BigDecimal handlingFee;

    /**
     * 保证金
     */
    @ApiModelProperty(value = "保证金")
    @JsonSerialize(using = BigDecimalToPlainStringSerializer.class)
    private BigDecimal margin;

    /**
     * 收益，平仓时有值
     */
    @ApiModelProperty(value = "收益，平仓时有值")
    @JsonSerialize(using = BigDecimalToPlainStringSerializer.class)
    private BigDecimal profit;

    /**
     * 燃油费手续费
     */
    @ApiModelProperty(value = "燃油费手续费")
    @JsonSerialize(using = BigDecimalToPlainStringSerializer.class)
    private BigDecimal fuelHandlingFee;

    /**
     * 备注
     */
    @ApiModelProperty(value = "备注")
    private String remark;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTime;

    /**
     * 创建人id
     */
    @ApiModelProperty(value = "创建人id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long createBy;

    /**
     * 创建人名称
     */
    @ApiModelProperty(value = "创建人名称")
    private String createName;

    /**
     * 修改时间
     */
    @ApiModelProperty(value = "修改时间")
    private LocalDateTime updateTime;

    /**
     * 修改人id
     */
    @ApiModelProperty(value = "修改人id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long updateBy;

    /**
     * 修改人名称
     */
    @ApiModelProperty(value = "修改人名称")
    private String updateName;

    /**
     * 状态（委托状态（0委托中、1部分成交、2部分已撤销、3完全成交、4已撤销、5已过期）
     */
    @ApiModelProperty(value = "状态（委托状态（0委托中、1部分成交、2部分已撤销、3完全成交、4已撤销、5已过期）")
    private String status;

    /**
     * 是否删除（0否、null是）
     */
    @ApiModelProperty(value = "是否删除（0否、null是）")
    private String isDeleted;

}
